package com.example.xd.model_permission;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.xd.commen.ARouterPath;
import com.example.xd.model_permission.float_window_permission.FloatWindowManager;

@Route(path = "/model_permission/PermissionActivity")
public class PermissionActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.permission_activity_main);
        findViewById(R.id.btn_getPermission).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FloatWindowManager.getInstance().applyOrShowFloatWindow(PermissionActivity.this);

            }
        });
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance().build("/model_video/VideoActivity").navigation();
            }
        });
        TextView tv = findViewById(R.id.tv);
        Intent intent = getIntent();
        String text = intent.getStringExtra("text");
        String extra = intent.getStringExtra("extra");
        tv.setText("我是从：" + text + "来的");
        if (null != extra) {
            Toast.makeText(this, extra, Toast.LENGTH_SHORT).show();
        }
    }

}
